function [dofs,n_dof] = sort_dof_dis(posT,d)
% function [dofs,n_dof] = sort_dof_dis(T,d)
% Assume that the computation is elementwise,
% so the dofs on each element is not same;
% since the function of dofs is to indicate the global position of local matrix in global ones
% dofs is sorted into vector, which dofs(:,i) means the d.o.f. of triangle
% i

m = (d+1)*(d+2)/2;
nt = size(T,1);
dofs = zeros(m,nt);
n_dof = m*nt;
% for tri=1:posT
%         dofs(tri,:) = (n_dof + 1) : (n_dof + m);
%         n_dof = n_dof + m;
% end
last_dof = m*(nt-1);
for i = 1:m
    dofs(i,:) = i:m:(last_dof+i);
end 
